package cn.stylefeng.guns.modular.tool.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.tool.entity.ToolExpressReconciliationZtInstall;
import cn.stylefeng.guns.modular.tool.model.params.ToolExpressReconciliationZtInstallParam;
import cn.stylefeng.guns.modular.tool.service.ToolExpressReconciliationZtInstallService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import cn.stylefeng.guns.sys.modular.system.entity.User;
import cn.stylefeng.guns.sys.modular.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 中通报价设置控制器
 *
 * @author zhucx
 * @Date 2023-01-29 14:08:48
 */
@Controller
@RequestMapping("/toolExpressReconciliationZtInstall")
public class ToolExpressReconciliationZtInstallController extends BaseController {

    private String PREFIX = "/tool/toolExpressReconciliationZtInstall";

    @Autowired
    private ToolExpressReconciliationZtInstallService toolExpressReconciliationZtInstallService;

    @Autowired
    private UserService userService;

    /**
     * 跳转到主页面
     *
     * @author zhucx
     * @Date 2023-01-29
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/toolExpressReconciliationZtInstall.html";
    }

    /**
     * 新增页面
     *
     * @author zhucx
     * @Date 2023-01-29
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/toolExpressReconciliationZtInstall_add.html";
    }

    /**
     * 编辑页面
     *
     * @author zhucx
     * @Date 2023-01-29
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/toolExpressReconciliationZtInstall_edit.html";
    }

    /**
     * 新增接口
     *
     * @author zhucx
     * @Date 2023-01-29
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(ToolExpressReconciliationZtInstallParam toolExpressReconciliationZtInstallParam) {
    	User user = userService.getcurrentUser();
    	toolExpressReconciliationZtInstallParam.setDeptId(user.getDeptId());
    	toolExpressReconciliationZtInstallParam.setDeliverId(user.getDeliverId());
    	toolExpressReconciliationZtInstallParam.setCreateUserName(user.getName());
        this.toolExpressReconciliationZtInstallService.add(toolExpressReconciliationZtInstallParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author zhucx
     * @Date 2023-01-29
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(ToolExpressReconciliationZtInstallParam toolExpressReconciliationZtInstallParam) {
        this.toolExpressReconciliationZtInstallService.update(toolExpressReconciliationZtInstallParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author zhucx
     * @Date 2023-01-29
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(ToolExpressReconciliationZtInstallParam toolExpressReconciliationZtInstallParam) {
        this.toolExpressReconciliationZtInstallService.delete(toolExpressReconciliationZtInstallParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author zhucx
     * @Date 2023-01-29
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(ToolExpressReconciliationZtInstallParam toolExpressReconciliationZtInstallParam) {
        ToolExpressReconciliationZtInstall detail = this.toolExpressReconciliationZtInstallService.getById(toolExpressReconciliationZtInstallParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author zhucx
     * @Date 2023-01-29
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(ToolExpressReconciliationZtInstallParam toolExpressReconciliationZtInstallParam,String condition ) {
    	User user = userService.getcurrentUser();
    	toolExpressReconciliationZtInstallParam.setDeptId(user.getDeptId());
        return this.toolExpressReconciliationZtInstallService.findPageBySpec(toolExpressReconciliationZtInstallParam,condition, user.getOperateId());
    }

}


